package org.koyad.portal.utils;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

public class FileUtils {
	
	private static final LogUtils LOGGER = LogUtils
			.getLogger(FileUtils.class);
	
	public static String readFileAsString(InputStream is) {
		
		StringBuffer buffer = new StringBuffer();
		try {
			BufferedReader buffRed = new BufferedReader(new InputStreamReader(is));
			String line = null;
			
			while((line = buffRed.readLine()) != null) {
				buffer.append(line.replace("\t", " "));
			}
			buffRed.close();
		} catch (Exception e) {
			LOGGER.logException(e);
		}
		return buffer.toString();
	}
}
